package com.fzl.spring_chatroom.controller;


import com.fzl.spring_chatroom.model.dao.MessageSession;
import com.fzl.spring_chatroom.model.dao.MessageSessionUserItem;
import com.fzl.spring_chatroom.model.response.MessageResponse;
import com.fzl.spring_chatroom.model.response.MessageSessionUserItemResponse;
import com.fzl.spring_chatroom.service.MessageSessionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Slf4j
@RestController
@RequestMapping("/message")
public class MessageSessionController {
    @Autowired
    private MessageSessionService messageSessionService;

    @RequestMapping("/SessionList")
    public List<MessageSession> getMessageSessionList(Integer userId) {
        log.info("获取会话列表，当前用户："+userId);
        return messageSessionService.getMessageSessionList(userId);
    }

    @RequestMapping("/addMessageSession")
    public MessageSessionUserItemResponse addMessageSession(Integer toUserId, Integer selfUserId) {
        log.info("增加会话");
        return messageSessionService.addMessageSession(toUserId,selfUserId);
    }



}
